/*
 * File:   10986.cpp
 * Author: xerxes
 *
 * Created on September 19, 2011, 2:35 PM
 *
 * I have not failed, I have just found 10000 ways that won't work.
 */

#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <iomanip>

#include <ctime>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>
#include <cstdlib>

using namespace std;

#define VI vector< int >
#define CI( x ) scanf("%d",&x)
#define CL( x ) scanf("%lld",&x)
#define CD( x ) scanf("%lf",&x )
#define foR(i,st,ed) for(int i = st ; i < ed ; ++i )
#define fo( i, ed ) foR( i , 0 , ed )
#define foE(i,st,ed) for(int i = st ; i <= ed ; ++i )
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip system("pause")
#define Int long long
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define mk make_pair
#define f first
#define s second
#define SET( ARRAY , VALUE ) memset( ARRAY , VALUE , sizeof(ARRAY) )

inline void wait(double seconds) {
    double endtime = clock()+(seconds * CLOCKS_PER_SEC);
    while (clock() < endtime) {
        ;
    }
}

int F[20005];
int D[20005];
int S,T;
int N,M; // number of nodes and number of edges


#define pi pair< int , int >

vector< vector<pi> >cango;
inline void Read() {
    CI(N);
    CI(M);
    CI(S);
    CI(T);

    cango.assign(N+5, vector< pi >() );
    int x,y,z;
    
    fo(i,M){
        CI(x);
        CI(y);
        CI(z);
        //cout<<x<<" "<<y<<" "<<z<<"\n";
        cango[x].pb( mk(y,z) );
        cango[y].pb( mk(x,z) );
    }
}


inline int dijkstra(int sx, int sy){
    SET(F,0);
    fo(i,N){
        D[i]=(int)1023456789;
    }
    set< pi , less< pi > > pq;
    pq.insert( mk(0,sx) );
    D[sx] = 0;
    
    while( pq.empty()==false ){
        int father = pq.begin()->s;
        pq.erase(pq.begin());

        //cout<<"FROM : "<<father<<" :\n";wait(.2);
        assert(father>=0);
        assert(father<=N);
        if( F[father] )continue;

        for(int i=0,j=SZ(cango[father]); i<j;++i ){
            int child = cango[father][i].f;
            int ccost = cango[father][i].s;

          //  cout<<"Go ... "<<child<<"\n";wait(.5);

            assert( child>=0 );
            assert( child<=N );
            
            if( F[child]==0 && D[father]+ccost < D[child] ){
                D[child] = D[father]+ccost;
                pq.insert( mk(D[child],child) );
            }

        }
        //cout<<"\n";
        F[father]=1;
    }

    return D[sy] < (int)1023456789 ? D[sy] : -1;
}
inline void Proc(int k) {
    int var = dijkstra(S,T);
    if( var!=-1)
        printf("Case #%d: %d\n",k,var);
    else
        printf("Case #%d: unreachable\n",k);
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("in", "rt", stdin);
#endif
    int cases = 1,K=1;
    for (CI(cases); cases; --cases,++K) {
        Read();
        Proc(K);
    }

    return 0;
}


